#include <algorithm>
#include <cstdio>
#include <set>

int n, m;
std::set<int> set;

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("testdata.in", "r", stdin);
  freopen("testdata.out", "w", stdout);
#else
  freopen("T1.in", "r", stdin);
  freopen("T1.out", "w", stdout);
#endif
#endif

  scanf("%d%d", &n, &m);
  set.insert(0), set.insert(n);
  for (int k; m; m--) {
    scanf("%d", &k);
    std::set<int>::iterator l = --set.upper_bound(k);
    std::set<int>::iterator r = set.upper_bound(k);
    printf("%lld\n", 1ll * (k - *l) * (*r - k));
    set.insert(k);
  }
  return 0;
}